<template>
  <card :title="title" more @handleMore="toNotice">
    <template v-slot:content>
      <div class="content">
        <div class="news" v-for="(item,index) in newsList" :key="index">
          <div class="left">
            <div class="info line-limit-length">{{ item.noticeTitle }}</div>
            <div class="date">{{ item.createTime }}</div>
          </div>
          <svg-icon class="top_icon" icon-class="top" v-if="item.top" />
        </div>
        <div v-if="newsList.length==0" class="empty-text">
          暂无数据
        </div>
      </div>
    </template>
  </card>
</template>

<script>
import card from "@/views/homePage/components/card";
export default {
  props: {
    title: {
      type: String,
      default: ""
    },
    newsList: {
      type: Array,
      default: []
    }
  },
  data() {
    return {};
  },
  components: {
    card
  },
  mounted() {

  },
  methods: {
    toNotice(){
      this.$router.push("/system/notice");
    }
  }
};
</script>

<style lang="scss" scoped>
.content {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  .news {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.1rem 0.2rem;
    &:nth-child(1) {
      padding-top: 0;
    }
    &:hover {
      color: rgb(64, 158, 255);
      cursor: default;
    }
    .left {
      width: 100%;
      display: flex;
      align-items: center;
      .info {
        max-width: calc(100% - 2rem);
        font-size: 0.2rem;
        font-weight: 700;
        margin-right: 0.125rem;
      }
    }
    .top_icon {
      font-size: 0.3rem;
    }
    .line-limit-length {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap; //文本不换行，这样超出一行的部分被截取，显示...
    }
  }
}
.empty-text{
  line-height: 60px;
  width: 100%;
  color: #909399;
  text-align: center;
}
</style>
